package csel.controller.commands;

import csel.controller.enums.ActionEnum;
import csel.model.Model;
import csel.model.entity.SkillIndexOutOfBoundsException;
import csel.view.GameViewport;

public class NBUseOnSelfSkillCommand extends NBCommand
{
	private Model model;
	private GameViewport gameViewport;
	private ActionEnum actionEnum;

	public NBUseOnSelfSkillCommand(Model model, GameViewport gameViewport)
	{
		super();
		this.model = model;
		this.gameViewport = gameViewport;
	}

	public void parameterize(ActionEnum actionEnum)
	{
		this.actionEnum = actionEnum;
	}

	public void execute()
	{
		try
		{
			model.getPlayerCharacter().useSkillOnSelf(
					getInteger(actionEnum) + gameViewport.getOffset());
		} catch (SkillIndexOutOfBoundsException e)
		{
			
		}
	}

	public NBUseOnSelfSkillCommand clone()
	{
		NBUseOnSelfSkillCommand clone = (NBUseOnSelfSkillCommand)super.clone();
		return clone;
	}
}
